from django.contrib import admin

from .models import TradeAccount,Broker,Portfolios,Strategy


class PortfoliosAdmin(admin.ModelAdmin):

    def save_model(self, request, obj, form, change):
        if not change:
            print dir(request)
            obj.cur_cash = request.POST.get('init_cash')
            obj.save()


admin.site.register(Broker)
admin.site.register(TradeAccount)
admin.site.register(Portfolios,PortfoliosAdmin)
admin.site.register(Strategy)
# Register your models here.
